from django.contrib.auth.models import AbstractUser
from django.db import models


# Create your models here.
from mlh.utils.models import BaseModel


class User(AbstractUser):
    """用户模型类"""
    GENDER = (
        (0, "保密"),
        (1, "男"),
        (2, "女")
    )
    NUMBER = (
        (1, "绑定"),
        (0, "未绑定")
    )
    mobile = models.CharField(max_length=11, unique=True, verbose_name='手机号', null=True)
    nickname = models.CharField(max_length=32, verbose_name="昵称", null=True)
    real_name = models.CharField(max_length=32, verbose_name="真实姓名", null=True)
    avatar = models.ImageField(default="", verbose_name="头像", null=True)
    birth_time = models.CharField(max_length=32, verbose_name="出生日期", null=True)
    city = models.CharField(max_length=16, verbose_name="居住城市", null=True)
    address = models.CharField(max_length=32, verbose_name="通讯地址", null=True)
    personal_web = models.CharField(max_length=64, verbose_name="个人网址", null=True)
    gender = models.SmallIntegerField(choices=GENDER, verbose_name="性别", default=1, null=True)
    profile = models.TextField(verbose_name="个人简介", null=True)
    school = models.CharField(max_length=32, verbose_name="学校", null=True)
    company = models.CharField(max_length=32, verbose_name="公司或组织", null=True)
    real_avatar = models.ImageField(default='', verbose_name="真人头像", null=True)
    skills = models.TextField(verbose_name="技能表", null=True)
    # 假装都只有一个账号
    allow2 = models.SmallIntegerField(choices=NUMBER, verbose_name="QQ是否绑定", null=True)
    allow1 = models.SmallIntegerField(choices=NUMBER, verbose_name="微信是否绑定", null=True)
    allow3 = models.SmallIntegerField(choices=NUMBER, verbose_name="新浪是否绑定", null=True)
    weixin = models.CharField(max_length=32, verbose_name="微信号", null=True)
    qq = models.CharField(max_length=32, verbose_name="QQ号", null=True)
    weibo = models.CharField(max_length=32, verbose_name="微博号", null=True)


    class Meta:
        db_table = 'tb_users'
        verbose_name = '用户'
        verbose_name_plural = verbose_name

